const BASE_API = 'http://localhost:3000'

export function get(url:string){
  return fetch(BASE_API + url,{
    method:'GET',
    credentials:'include'// 前台加上这个参数，才能在跨域的时候加上cookie
  })
  .then(res => res.json())
}


export function post(url:string,payload){
  // console.log(payload,111111111)
  return fetch(BASE_API + url,{
    method:'POST',
    body:JSON.stringify(payload),
    credentials:'include',
    headers:{
      'Content-Type': 'application/json'
    }
  })
  .then(res => res.json())
}